-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update environment variables to use javascript-based config #249
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #249 +/- ##
=======================================
Coverage 96.36% 96.36%
=======================================
Files 194 194
Lines 1841 1841
Branches 324 324
=======================================
Hits 1774 1774
Misses 62 62
Partials 5 5 ☔ View full report in Codecov by Sentry. |
3c9e525
to
dfbdb59
Compare
779f0a4
to
2ba72d9
Compare
2ba72d9
to
f041d35
Compare
562e24a
to
ec4e9e8
Compare
src/setupTest.jsx
Outdated
/* | ||
When .env.test is removed, uncomment the env vars below and add any environment variables for testing with Jest | ||
|
||
Context: Snapshot is not currently not set up to be able to parse the environment variables in env.config.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: Snapshot is not currently not set up to be able to parse the environment variables in env.config.js | |
Context: Snapshot is not currently set up to be able to parse the environment variables in env.config.js |
The word "not" is repeated to make this a double negative
Learner Dashboard is now able to handle JS-based configuration! | ||
|
||
For the time being, the `.env.*` files are still made available when cloning down this repo or pulling from | ||
the master branch. To switch to using `env.config.js`, make a copy of `example.env.config.js` and configure as needed. | ||
|
||
For testing with Jest Snapshot, there is a mock in `/src/setupTest.jsx` for `getConfig` that will need to be | ||
uncommented. | ||
|
||
Note: having both .env and env.config.js files will follow a predictable order, in which non-empty values in the | ||
JS-based config will overwrite the .env environment variables. | ||
|
||
frontend-platform's getConfig loads configuration in the following sequence: | ||
- .env file config | ||
- optional handlers (commonly used to merge MFE-specific config in via additional process.env variables) | ||
- env.config.js file config | ||
- runtime config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 Thank you for adding this valuable context
Context:
In order to use Frontend Plugin Framework Library, every Host MFE needs to use a javascript-based configuration. Most of the groundwork was done in frontend-platform and frontend-build to allow for js-based configs to be used in MFEs, and Learner Dashboard will be the first to make this transformation.
In place of the
.env.*
files would be aenv.config.js
file that includes all of the variables that would have existed in.env.development
. Anexample.env.config.js
has been added and can be copied.When a team or developer makes the switch from
.env.*
toenv.config.js
, any env vars needed for testing with Jest Snapshot will need to be included insrc/setupTest.jsx
.Note: the
.env.*
files are not being deleted and a future date/announcement will be made when the master branch of Learner Dashboard no longer provides a.env
file.